<template>
<el-form ref="yhList" :model="yhList" label-width="80px" style="width:70%;margin:0px auto">
  <el-form-item label="账号" prop="userName">
    <el-input v-model="yhList.userName"></el-input>
  </el-form-item>
  <el-form-item label="昵称" prop="nickName">
    <el-input v-model="yhList.nickName"></el-input>
  </el-form-item>
  <el-form-item label="密码" prop="password">
    <el-input type="password" v-model="yhList.password"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="onSubmit">修改</el-button>
    <el-button @click="YHFH">返回</el-button>
  </el-form-item>
</el-form>
</template>

<script>
import { yhEditGet,yhEdit } from '../../api/yonghu'
export default {
  data(){
    return{
      id:"",
      yhList:{
        userName:"",
        nickName:"",
        password:""
      }
    }
  },
  async created(){
    this.id = this.$route.query.id
    const res = await yhEditGet(this.id)
    // console.log(res)
    this.yhList.userName = res.data.userName
    this.yhList.nickName = res.data.nickName
    this.yhList.password = res.data.password
  },
  methods:{
    onSubmit(){
      this.yhl(this.id,this.yhList)
      this.$router.push({
        name:"yh"
      })
    },
    YHFH(){
      this.$router.push({
        name:"yh"
      })
    },
    async yhl(id,yhList){
      const ress = await yhEdit(id,yhList)
    }
  }
}
</script>
